package com.example.util;

import org.dozer.Mapper;

import java.util.ArrayList;
import java.util.List;

public class ConvertUtil {

    public static <T, R> List<R> convertObject(Mapper mapper, List<T> list, Class<R> clazz){
        if (null == list){
            return null;
        }

        List<R> objects = new ArrayList<>();
        for (T t : list){
            objects.add(mapper.map(t, clazz));
        }
        return objects;
    }
}
